<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('考题管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>试卷标题：</label>
                                <input type="text" name="title"/>
                            </li>
                            <li>
                                <label>课程名称：</label>
                                <input type="text" name="courseName"/>
                            </li>
                            <li>
                                <label>考试班级：</label>
                                <input type="text" name="deptName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:sysTestPaper:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:sysTestPaper:edit')}]];
        var publishUrlFlag = [[${@permission.hasPermi('system:sysTestPaper:publish')}]];
        var detailFlag = [[${@permission.hasPermi('system:sysTestPaper:detail')}]];
        var prefix = ctx + "system/sysTestPaper";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                publishUrl: prefix + "/publish",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "考题管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '试卷ID',
                    visible: false
                },
                {
                    field: 'title',
                    title: '试卷标题'
                },
                {
                    field: 'courseName',
                    title: '课程名称'
                },
                {
                    field: 'deptName',
                    title: '考试班级名称'
                },
                {
                    field: 'startTime',
                    title: '开始时间'
                },
                {
                    field: 'endTime',
                    title: '结束时间'
                },
                {
                    field: 'duration',
                    title: '考试时间',
                    formatter(value) {
                        return value + "/分钟"
                    }
                },
                {
                    field: 'grade',
                    title: '满分',
                    formatter(value) {
                        return value + "/分"
                    }
                },
                {
                    field: 'createBy',
                    title: '创建人'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + publishUrlFlag + '" href="javascript:void(0)" onclick="$.operate.publish(\'' + row.id + '\')"><i class="fa fa-remove"></i>发布考试</a>');
                        actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-detail"></i>查看</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>